
//
//  FeedbackViewController.m
//  LuxuryGoods
//
//  Created by DCQ on 2018/5/25.
//  Copyright © 2018年 Future. All rights reserved.
//

#import "FeedbackViewController.h"
#import "LGImageManagerIO.h"
#import "UserInfoModel.h"

@interface FeedbackViewController ()
@property (weak, nonatomic) IBOutlet UIButton *submitBtn;
@property (weak, nonatomic) IBOutlet LGPlaceholderTextView *contentTV;
@property (weak, nonatomic) IBOutlet UILabel *contentLength;

@end

@implementation FeedbackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self setNavigationItemTitle:@"意见反馈"];
    UIImage * btnImg = [LGImageManagerIO createGradualColorImage:self.submitBtn.size startColor:UIColorFromRGB(0xE1CFA9) endColor:UIColorFromRGB(0xC1B284)];
    [self.submitBtn setBackgroundImage:btnImg forState:UIControlStateNormal];
    self.contentTV.layer.borderColor = UIColorFromRGB(0xb6b6b6).CGColor;
    self.contentTV.placeholder = @"您的意见反馈是我们前进的动力";
    self.contentLength.textColor = UIColorFromRGB(0x999999);
}
- (IBAction)submitAction:(id)sender {
    if (!self.contentTV.text || self.contentTV.text.length ==0) {
        [self showAlertView:@"请输入反馈意见" withConfirmAction:nil];
        return;
    }
    NSDictionary * params = @{@"content":self.contentTV.text,@"token":UserInfo.userToken};
    
    [[MainApi sharedInstance] postPath:@"User/addOpinion" params:params resultBlock:^(NSDictionary *responseObject, NSError *error) {
        if (!error) {
             [self backViewController];
        }
       
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
